package com.acti.ezscript.freeturn;

import org.activiti.engine.delegate.DelegateExecution;
/**
 * @author mxncandy
 */
public class DefaultSpecialCondition implements SpecialCondition{
	
	private String key;
	private Object val;
	public DefaultSpecialCondition(String key,Object val){
		this.key = key;
		this.val = val;
	}

	public boolean evaluate(DelegateExecution execution) {
		Object val = execution.getVariable(key);
		boolean result = val != null && val.equals(this.val);
		if(result){
			execution.removeVariable(key);
			execution.removeVariable(SpecialCondition.TRAN_TO_SPECIAL);
		}
		return result;
	}
	
	

}